<script setup lang="ts">
  import { request } from '@/utils/http'
  import { getCodeApi } from '../apis/user'
  import { useCounterStore } from '@/stores/counter'

  // 测试登录
  const login = async () => {
    const res = await request.post('/login/password', {
      mobile: '13230000004',
      password: 'abc12345',
    })
    console.log(11111, res)
  }
  const login2 = async () => {
    const res = await request.post('/login/password', {
      mobile: '',
      password: 'abc12345',
    })
    console.log(2222, res)
  }

  // 测试获取验证码
  const getMobileCode = async () => {
    const res = await getCodeApi({ mobile: '13211112222', type: 'login' })
    console.log(res.code)
  }

  const store = useCounterStore()
</script>

<template>
  <view>
    <navigator url="/pages/login/index">去登录页</navigator>
    <image src="@/static/logo.png" />
    <text class="test-class">对齐</text>
    <text class="iconfont icon-location"></text>
    <text class="uniui-icon-symbol-tool-03"></text>
    <button @click="login()">测试登录-成功</button>
    <button @click="login2()">测试登录-失败</button>
    <button type="primary" @click="getMobileCode">测试获取验证码</button>
    <view>计数: {{ store.count }}</view>
    <view>双倍: {{ store.double }}</view>
    <button @click="store.increment()">加1</button>
    <button @click="store.decrement()">减1</button>
  </view>
</template>

<style lang="scss">
  @import '@/uni.scss';
  .test-class {
    @include text-overflow(2);
  }

  .icon-location {
    font-size: 100rpx;
    color: red;
  }

  .uniui-icon-symbol-tool-03 {
    width: 100rpx;
    height: 100rpx;
  }
</style>
